package iOperation;

import book.Book;
import book.BookList;

import java.util.Scanner;

/**
 * @Author: Lenovo
 * @Date: 2024/5/24 19:24
 * @description:
 */
public class FindOperation implements IOPeration {
    public void work(BookList bookList){
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入你想查阅的书名");
        String name=scanner.nextLine();
        int currentSize=bookList.getUseSize();
        for (int i = 0; i < currentSize; i++) {
            Book book=bookList.getBook(i);
            if(book.getName().equals(name)){
                System.out.println("找到了图书:");
                System.out.println(book);
                return;
            }
        }
        System.out.println("没有找到你想查阅的书籍");
    }
}
